/**
 * 功能描述  餐饮落实，弹出表单
 */
define(function (require, exports, module) {

	var Form = require("form");
	var enmu = require("enums");
	var moment = require("moment");
	
    var instance = {
        initComponent: function (widget,minDate,maxDate) {
        	var dateItem = null;
        	if(minDate){
        		dateItem = {
						name:"dateOfDinnerRange",
						label:"用餐日期",
						type:"daterange",
						minDate: moment(minDate).format("YYYY-MM-DD"),
						maxDate: moment(maxDate).format("YYYY-MM-DD"),
						startDate: moment(minDate),
						endDate: moment(maxDate),
					}
        	}else{
        		dateItem = {
						name:"dateOfDinner",
						label:"用餐日期",
						type:"date"
					}
        	}
        	
        	var items = [{
							name:"pkDinner",
							type:"hidden"
						},
						dateItem,
						{
							name:"dinnerSort",
							label:"餐饮类别",
							type:"select",
							options:enmu["com.eling.elcms.travel.model.Dinner.DinnerSort"],
							defaultValue:"Breakfast",
						},{
							name:"dinnerDate",
							label:"用餐时间",
							type:"date",
							mode: "HH:mm",
						},{
							name:"perNumber",
							label:"人数"
						},{
							name:"level",
							label:"标准",
						},{
							name:"dinnerAddress",
							label:"用餐地点",
						},{
							name:"taste",
							label:"口味(客源地)",
						},{
							name:"preference",
							label:"餐位偏好及保留时间",
						},{
							name:"species",
							label:"指定菜",
						},{
							name:"drinks",
							label:"酒水饮料",
						},{
							name:"isValid",
							type:"hidden",
							defaultValue:"true"
						},{
							name:"version",
							type:"hidden",
						}];
        	
        	
        	
        	
        	var form = new Form({
        		autoRender:false,
        		model:{
        			layout : '2_1',
        			id: "dinnerForm",
                    defaultButton : false,
        			items:items
        		}
        	});
        	return form
        }
    };
    module.exports = instance;
	
});